const path = require('path')
const htmlWebpackPlugin = require('html-webpack-plugin')
const VueLoaderPlugin = require('vue-loader/lib/plugin')

module.exports = {
    entry: path.join(__dirname, './src/main.js'),//入口，要使用webpack打包哪个文件
    output: {//输出相关的配置
        path: path.join(__dirname, './dist'),//指定打包好的文件，输出到哪个目录中去
        filename: 'bundle.js'//这里指定输出的文件名称
    },
    mode: 'development',
    plugins: [
        new htmlWebpackPlugin({
            template: path.join(__dirname, './src/index.html'),
            filename: 'index.html'
            
        }),
        new VueLoaderPlugin()

    ],
    module: {
        rules: [
            { test: /\.css$/, loader: ['style-loader', 'css-loader'] },
            { test: /\.less$/, loader: ['style-loader', 'css-loader', 'less-loader'] },
            { test: /\.scss$/, loader: ['style-loader', 'css-loader', 'sass-loader'] },
            { test: /\.(jpg|png|bmp|jpeg)$/, loader: 'url-loader?limit=8000&name=[hash:8]-[name].[ext]' },
            { test: /\.(ttf|eot|svg|woff|woff2)$/, loader: 'url-loader' },
            { test: /\.js$/, loader: 'babel-loader', exclude: /node_modules/ },
            { test: /\.vue$/, loader: 'vue-loader' }
        ]
    },
    resolve: {
        alias: {
            // "vue$": "vue/dist/vue.js"
        }
    }

}
